package com.zking.service.impl.lj;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.zking.dao.domain.Information;
import com.zking.dao.mapper.lj.InfMapper;
import com.zking.service.lj.InfService;
import com.zking.service.lj.MailService;
@Service
public class InfServicelmpl implements InfService{
	@Autowired
	InfMapper im;
	
	@Autowired
	MailService mailService;
	
	@Override
	public List<Information> getInformations(String com_audit) {
		List<Information> informations = im.getInformations(com_audit);
		return informations;
	}
	@Override
	public Information getInformation(Integer id) {
		Information information = im.getInformation(id);
		return information;
	}
	@Override
	@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED)	
	public int updateInformation(Integer id, String com_audit,String to, String subject, String content) {
		int i = im.updateInformation(id, com_audit);
		 mailService.sendSimpleMail(to, subject, content);
		return i;
	}
	@Override
	public List<Information> getInfs() {
		List<Information> informations = im.getInfs();
		return informations;
	}
	@Override
	public int deleteinf(Integer id) {
		int i = im.deleteinf(id);
		return i;
	}

}
